package project1;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.Toolkit;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class FeuCirculation2
  extends JApplet
  implements MouseListener
{
  private int intensite;
  private SurfaceDessin surface;
  private Image [] dessin;
  
  public FeuCirculation2()
  {
  }

  private void jbInit()
    throws Exception
  {
    this.getContentPane().setLayout( null );
  }


  public void init()
  {
    this.addMouseListener(this);
    surface = new SurfaceDessin();
    surface.setSize(200,200);
    surface.setLocation(200,20);
    this.getContentPane().add(surface); 
    surface.setVisible(true);
    try
    {
      jbInit();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  static {
    try
    {
    }
    catch (Exception e)
    {
    }
  }
  
  

  public static void main(String[] args)
  {
    FeuCirculation2 applet = new FeuCirculation2();
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    frame.setTitle( "Applet Frame" );
    applet.init();
    applet.start();
    frame.setSize(800, 600);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    frame.setLocation((d.width-frameSize.width)/2, (d.height-frameSize.height)/2);
    frame.setVisible(true);
  }

  public void start()
  {
  }

  public void stop()
  {
  }

  public void destroy()
  {
  }

  public void mouseClicked(MouseEvent e)
  {
    intensite++;
    surface.repaint();
  }

  public void mousePressed(MouseEvent e)
  {
  }

  public void mouseReleased(MouseEvent e)
  {
  }

  public void mouseEntered(MouseEvent e)
  {
  }

  public void mouseExited(MouseEvent e)
  {
  }
  static {
    try
    {
    }
    catch (Exception e)
    {
    }
  }

  public class SurfaceDessin extends JPanel
          {
            protected void paintComponent(Graphics g)
                    {
                            
                            super.paintComponent(g);
                
                           // OVAL GRADIENT
                            //Graphics2D g2 = (Graphics2D)g;
                            //g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
                            setBackground(Color.PINK);
                           // g2.setColor(Color.RED);
                           // g2.setPaint(new GradientPaint(0,0,Color.BLUE,300,0,Color.PINK));
                           // g2.fillOval(10,10,500,500);
                            g.setColor(Color.YELLOW);
                            g.fillOval(10,50,20,20);
                            g.setColor(Color.GREEN);
                            g.fillOval(10,90,20,20);
                            
                    } 

          }
}